package publisherSubscriber.examples;

import publisherSubscriber.Factory;
import publisherSubscriber.Subscriber;

public class SubscriberApp {

	public static void main(String[] args) {
		try {
			if(args.length != 4){
				System.out.println("Usage: SubscriberApp host port topicName subscriberName");
				System.exit(1);
			}
			
			Factory factory = new Factory(args[0],args[1]);
			Subscriber subscriber = factory.createSubscriber(args[2],args[3]);
			subscriber.setAction(new TestAction());
			System.out.println(subscriber.getSubsciberName()+" subscriber connected.");			

			
		} catch (Exception e) {			
			e.printStackTrace();
		}

	}

}
